<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>

<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="col-sm-6 text-left">
						<button type="button" th:each="league1:${leagueList}"
							th:text="${league1.season}"
							th:class="${league1.season eq season?'btn btn-success':'btn btn-info'}"
							th:id="${league1.season}" onclick="returnNewDocument(this.id);">新</button>
					</div>
					<div class="col-sm-6 text-right">
						<button class="btn btn-success" onclick="exportPdf()">导出数据</button>
						<a class="btn btn-success" th:href="@{'/oupei/match/download/' + ${turn} +'/'+${league.id}}">完全导出</a>
						<button class="btn btn-success" onclick="addAnalyse()">综合分析</button>
					</div>
					<div class="col-sm-12">
						<div class="btn-group btn-group">
							<button type="button" th:each="turn1:${turnList}"
								th:text="${turn1}" th:id="${turn1}"
								th:class="${turn1 eq turn?'btn btn-info':'btn btn-link'}"
								onclick="returnNewDocument1(this.id)"></button>
						</div>
					</div>
					<div>
						<table class="table table-hover table-bordered">
							<thead>
								<tr class="bg-success">
									<th class="col-12 text-center"><input type="checkbox"
										th:id="all" onclick="selectAll()" name="allInfo" /></th>
									<th class="col-1 text-center">时间</th>
									<th class="col-1 text-center">联赛</th>
									<th class="col-1 text-center">轮次</th>
									<th class="col-1 text-center">主队</th>
									<th class="col-1 text-center">比分</th>
									<th class="col-1 text-center">客队</th>
									<th class="col-3 text-center">分析</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="match:${matchList}"
									th:class="${matchStat.odd?'success':''}">
									<td class="col-1 text-center"><input type="checkbox"
										name="matchInfo" th:id="${match.ticketsId}"
										onclick="selectOne(this.id)" /></td>
									<td class="col-1 text-center"><span
										class="label label-success" th:text="${name}"></span></td>
									<td class="col-1 text-center"
										th:text="${#dates.format(match.matchDate, 'yyyy-MM-dd hh:mm')}" />
									<td class="col-1 text-center" th:text="${match.turn}" />
									<td class="col-1 text-center" th:text="${match.homeTeam}" />
									<td class="col-1 text-center"><strong><div
												class="text-danger" th:text="${match.score}"></div></strong></td>
									<td class="col-1 text-center" th:text="${match.guestTeam}" />
									<td class="col-3 text-center"><a target="_blank" class="btn btn-primary btn-sm"
										th:href="@{'/oupei/match/analysis/'+${match.ticketsId}}">分析</a> 
									<a class="btn btn-danger btn-sm" th:onclick="'javascript:returnOdds('+${match.id}+','+${match.ticketsId}+','+${#dates.format(match.matchDate, 'yyyyMMddhhmm')}+')'">欧赔</a> 
									<a target="_blank" class="btn btn-warning btn-sm"
										th:href="@{'http://odds.cp.360.cn/jczqdatax/analy?match='+${match.ticketsId}}">360</a>
										<a target="_blank" class="btn btn-success btn-sm"
										th:href="@{'http://zq.win007.com/analysis/'+${match.ticketsId}+'.htm'}">球探</a></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
		<div th:include="include :: footer"></div>
	<script th:inline="javascript">
		function returnNewDocument(id){
			 /*<![CDATA[*/  
		    var name = /*[[${name}]]*/;//取值  
		   /*]]>*/  
			window.location.href="/oupei/match/league/"+name+"/" + id;
		}
		function returnNewDocument1(id){
			 /*<![CDATA[*/  
		    var name = /*[[${name}]]*/;//取值  
		   /*]]>*/ 
		    /*<![CDATA[*/  
		    var season = /*[[${season}]]*/;//取值  
		   /*]]>*/  
			window.location.href="/oupei/match/league/"+name+"/" + season+"/"+id;
		}
		function exportPdf(){
			var data ="";
			 var names = document.getElementsByName("matchInfo");
			 for(var i=0;i<names.length;i++){  
                 if(names[i].checked)data = data+"-"+names[i].id;  
          } 
			 window.location.href="/oupei/match/download/"+data;
		}
		
		function addAnalyse(){
			 /*<![CDATA[*/  
		    var turn = /*[[${turn}]]*/;//取值  
		   /*]]>*/
		    /*<![CDATA[*/  
		    var id = /*[[${league.id}]]*/;//取值  
		   /*]]>*/  
			layer.open({
				type : 2,
				title : '编辑',
				maxmin : true,
				shadeClose : false, // 点击遮罩关闭层
				area : [ '800px', '520px' ],
				content :  '/oupei/synthesis/add/' + turn +"/"+id// iframe的url
			});
		}
  
		function returnOdds(id,ticketsId,matchDate){
			layer.open({
				type : 2,
				title : '赔率信息',
				maxmin : true,
				shadeClose : false, // 点击遮罩关闭层
				area : [ '800px', '520px' ],
				content :  '/oupei/odds/odds/'+id+'/'+ticketsId+'/'+matchDate// iframe的url
			});
		}
        //全选  
        function selectAll() {  
            var names = document.getElementsByName("matchInfo");
            if(document.getElementsByName("allInfo")[0].checked){
            	for(var i=0;i<names.length;i++){  
                    names[i].checked=true;  
             } 
            }else{
            	for(var i=0;i<names.length;i++){  
                    names[i].checked=false;  
             } 
            }
        } 
        function selectOne(id){
        	if(!document.getElementById(id).checked){
        		document.getElementsByName("allInfo")[0].checked=false;
        	}
        }
	</script>

</body>
</html>